package crudfx.util;
import javafx.reflect.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class Reflector{
    public var fullClassName:String="";
    init{}
    public function dumpInfo():Void{
        println(fullClassName);
        println("mixin-----------");
        var context:FXLocal.Context=FXLocal.Context.getInstance();

        var cls:FXClassType=context.findClass(fullClassName);
        var c:java.util.List=cls.getSuperClasses(true);
        for(i in c){
            println(i);
        }
        //var objValue:FXObjectValue=cls.allocate();
        //var instrument:Number=50;
        //objValue.initVar("instrument", context.mirrorOf(instrument));
        //objValue.initialize();
        //var fnA=cls.getFunction("play", []);
        //fnA.invoke(objValue, []);
        println("members------------------------");
        var memberFilter:FXMemberFilter=new FXMemberFilter();
        var members:java.util.List=cls.getVariables(false);
        for(i in members){
            var vm:FXVarMember=i as FXVarMember;
            var t:FXType=vm.getType();
            println(vm);
            println("\t{t.getName()}");
            println("\t{t.getSequenceType()}");
            }
        println("functions---------------------");
        var functions:java.util.List=cls.getFunctions(false);
        for(i in functions){
            var fm:FXFunctionMember=i as FXFunctionMember;
            println(fm);
            }
        //objValue.getFunctions("",true);
        /*
         var fnC = cl.getFunction("methodC", []);
    var fnCVal = fnC.invoke(ni, []);
    if (fnCVal.getItemCount() > 0) {
        for (i in [0..fnCVal.getItemCount() - 1) {
            var f = Float.parseFloat(fnCVal.getItem(i).getValueString());
            println("Value at index {i} is {f}");
        }
    }

        */
        /*println("ALL-----------");
        var a:java.lang.Class[]=Tools.getClasses("javax.swing");
        for(i in a)println(i);*/
        println("javafx---------------");
        Tools.getClasses("javafx");
        println("crudfx---------------");
        Tools.getClasses("crudfx");
        }
    }
